Skip to content

Conversation

@chFlorian
Copy link
Member

Hey Trent!

In this PR I have removed ActionButtonModel, because I don't see any usage for it being an independent data type.
Instead, I have added associated values to the three cases of ActionButtonState: title, systemImage

This way the API is quite a bit easier to read:

@State var buttonState: ActionButtonState = .enabled(title: "Hello, World!", systemImage: "house")

For comparison, this is the old API:

@State var buttonState: ActionButtonState = .enabled(.init(title: "Hello, World!", systemImage: "house"))

What do you think?

I also removed the test target, because there were no actual tests.

Copy link
Member

@trentguillory trentguillory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! This is much more readable. And thanks for collapsing that switch statement in ActionButtonState. It's much clearer.

@trentguillory trentguillory merged commit 5c5d92a into swiftui-library:main Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants